// 文件名：week1\problem\lc2269_欧琳琳.cpp
// 提交链接：https://leetcode.cn/problems/find-the-k-beauty-of-a-number/submissions/560153486?envType=problem-list-v2&envId=sliding-window
// 2269. 数字，字符串，滑动窗口
// 完成日期：2024/08/31
// c++，字符串及提取其子字符串

class Solution {
public:
    int divisorSubstrings(int num, int k) {
         string num1=to_string(num);
         int n=num1.length();
         int count=0;
         for (int start=0;start<=n-k;start++)
         {
            int num2=stoi(num1.substr(start,k));
            if(num2!=0&&num%num2==0)
            {
                count++;
            }
         }
         return count;
    }
};